package gxprod.androidai;

import gxprod.androidai.functions.Function;
import gxprod.androidai.regex.MatchResult;
import gxprod.androidai.regex.NamedPattern;

public abstract class QueryAccepter {
	
	protected Function Function;
	protected int MatchId;
	
	public QueryAccepter(Function function, int matchId) {
		Function = function;
		MatchId = matchId;
	}	
	public abstract MatchResult check(String input);
	
	
	public class BasicQueryAccepter  extends QueryAccepter {
		protected NamedPattern[] Patterns;
		protected float Confidence;
		
		public BasicQueryAccepter(Function function, NamedPattern[] patterns, float confidence, int matchId) {
			super(function, matchId);
			Patterns = patterns;
			Confidence = confidence;
		}
		@Override
		public MatchResult check(String input) {
			return Function.isMatch(input, Patterns, Confidence);
		}	
	}
}
